# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: db\tables\ui_sessions.py
__author__ = "sanyi"
from sqlalchemy import *
from sqlalchemy.orm import mapper
from sqlalchemy.dialects.postgresql import UUID as C_UUID
from sqlalchemy.dialects.postgresql import JSONB as TYPE_JSONB
from db.tables import metadata

UiSessionsTable = Table(
    "ui_sessions",
    metadata,
    Column("session_id", C_UUID, primary_key=True),
    Column("key", TEXT, index=True),
    Column(
        "user_id",
        C_UUID,
        ForeignKey("users.user_id", ondelete="CASCADE"),
        nullable=False,
        index=True,
    ),
    Column("expires", DateTime(true), index=True, nullable=False),
    Column("created", DateTime(true), default="now()", nullable=False),
    Column("validity", INTEGER),
    Column("data", TYPE_JSONB),
    Column("src", TEXT),
)


class UiSessionRow(object):
    key = None
    session_id = None
    user_id = None
    expires = None
    created = None
    validity = None
    data = None
    src = None

    def __str__(self):
        return "R_ui_sessions[%s]" % (self.session_id,)

    def __repr__(self):
        return self.__str__()


mapper(UiSessionRow, UiSessionsTable)
